import request from "../request";

const controller = "Other";

export const getNoticeList_API = (data) => {
    return request.get(`${controller}/getNoticeList`);
};

export const getNoticeOfNew_API = (data) => {
    return request.get(`${controller}/getNoticeOfNew`);
};

export const loadMessage_API = (data) => {
    return request.post(`${controller}/loadMessage?${queryStr(data)}`);
};

export const getMessageList_API = (data) => {
    return request.get(`${controller}/getMessageList?${queryStr(data)}`);
};

export const delMessage_API = (data) => {
    return request.post(`${controller}/delMessage?${queryStr(data)}`);
};

export const getMessageNewCount_API = (data) => {
    return request.get(`${controller}/getMessageNewCount?${queryStr(data)}`);
};

const queryStr = (data) => {
    let str = "";
    for (var key in data) {
        str += `${key}=${data[key]}&`;
    }
    if (str[str.length - 1] == "&") {
        str = str.substring(0, str.length - 1);
    }
    return str;
};
